import { Application } from 'egg';

export default (app: Application) => {
    const { STRING, DATE, CHAR, TEXT } = app.Sequelize;
    const model = app.model.define('Activity', {
        activity_id: { type: CHAR(32), primaryKey: true },//主键
        activity_title: STRING(32),//标题
        user_id: CHAR(32),//活动发起人id
        activity_sponsors: STRING(32),//活动发起人
        activity_sponsors_phone: STRING(32),//活动发起人联系方式
        activity_nature: CHAR(1),//性质（1：校内，2：校外）
        activity_school_id: STRING(32),//学校id
        activity_college_id: STRING(32),//学院id
        activity_type: CHAR(1),//类型（1：官方活动，2：用户活动）
        activity_start_time: DATE(0),//开始时间
        activity_end_time: DATE(0),//结束时间
        activity_place: STRING(50),//活动地点
        activity_suto: STRING(50),//素拓分
        activity_detail: TEXT,//活动说明
        activity_detail_picture: STRING(300),//活动图片
        activity_cover: STRING(50),//活动封面
        activity_status: CHAR(1),//活动状态（1：正常，2：暂停，3：已结束）
        activity_auditing_status: {type:CHAR(1),defaultValue:'2'},//活动状态（1：待审核，2：通过，3：不通过）
        created_by: STRING(32),
        updated_by: STRING(32),
        is_delete: CHAR(1),
    }, { tableName: 't_activity' });
    return model;
};

export class Activity {
    activity_id: string;
    activity_title: string;
    user_id: string;
    activity_sponsors: string;
    activity_sponsors_phone: string;
    activity_nature: string;
    activity_type: string;
    activity_school_id: string;
    activity_college_id: string;
    activity_start_time: string;
    activity_end_time: string;
    activity_place: string;
    activity_suto: string;
    activity_detail: string;
    activity_detail_picture: string;
    activity_cover: string;
    activity_status: string;
    activity_auditing_status: string;
    created_by: string;
    updated_by: string;
    is_delete: string;
}
